import { SkillMainPanel } from "../SkillMainPanel";
import { SkillItemMarry } from "./SkillItemMarry";
import { SkillItem } from "../SkillItem";
import { SkillInfo } from "../../../model/SkillInfo";
import { SkillMarryMapPanel } from "./SkillMarryMapPanel";
import { SkillMarryInfoPanel } from "./SkillMarryInfoPanel";
//class SkillMarryPanel
    
    export  class SkillMarryPanel extends SkillMainPanel
    {
        constructor()
        {
            super();
            return;
        }

        protected onSkillMapClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=null;
            if (typeof arg1.target === "skillitemmarry") 
            {
                loc1 = (arg1.target as SkillItemMarry).skillItem;
            }
            else 
            {
                loc1 = (arg1.target as Object /* flash.display.DisplayObject */).parent as SkillItem;
            }
            if (loc1) 
            {
                if (_skillInfo.skillId == loc1.skillData.skillId) 
                {
                    return;
                }
                updateSkillInfo(loc1.data as SkillInfo);
                _skillList.itemClick(loc1.data.position);
            }
            return;
        }

        protected /* override */ creatChirldren(): void
        {
            super.creatChirldren();
            _skillList = new SkillMarryMapPanel();
            addChild(_skillList);
            _skillList.addEventListener(flash.events.MouseEvent.MOUSE_DOWN, this.onSkillMapClickHandler);
            _skillInfo = new SkillMarryInfoPanel();
            addChild(_skillInfo);
            return;
        }

        protected /* override */ updateSize(): void
        {
            _skillList.x = 0;
            _skillList.y = 0;
            _skillInfo.x = 256;
            _skillInfo.y = 0;
            return;
        }
    }
